package com.lgw.coupon.vo;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TemplateRequest {

    //优惠券名称
    private String name;
    //优惠券分类
    private String category;
    //总数
    private Integer couponCount;
    //过期时间
    private Date deadline;


    public boolean validate() {
        boolean stringValid = StrUtil.isNotEmpty(name) && StrUtil.isNotEmpty(category);
        boolean numValid = couponCount > 0;
        boolean timeValid = deadline.getTime() > new Date().getTime();
        return stringValid && numValid && timeValid;
    }
}
